<script setup lang="ts">
import menuStore from "@/piniaStore/menuStore.ts";
import showHideMenu from "@/piniaStore/showHideMenu.ts";
import {UserModel} from "@/interfaces/apiResponse.ts";
import myLocalStore from "@/composables/myLocalStore.ts";
const router = useRouter();
const route = useRoute();
const menu  = menuStore();
menu.init();
watch(route,()=>{
  menu.addHistoryMenu(route);
  menu.setCurrentMenu(route);
},{
  immediate:true
});
const info:UserModel = myLocalStore().get('userInfo');
if(info.is_super_admin == 'no' || !info.is_super_admin) router.push({name:"home"});
</script>

<template>
  <main class="all" >
    <layout-menu/>
    <div class="content" :class="{'w-screen':!showHideMenu().show}">
      <div class="top">
        <layout-breadcrumb/>
        <layout-history />
      </div>
      <div class="main relative overflow-y-auto">
        <router-view #default="{Component,route}">
          <component :is="Component" :key="route.fullPath" class="absolute w-full"/>
        </router-view>
      </div>
    </div>
  </main>
</template>

<style lang="scss" scoped>
main.all {
  @apply h-screen w-screen grid grid-cols-[auto_1fr];
  div.content {
    @apply bg-slate-200 grid grid-rows-[auto_1fr] text-gray-700 ;
    div.top {



    }

    div.main {
      @apply mt-2 bg-white;
    }
  }
}
</style>